package com.lm.dubbo.example;

import com.lm.dubbo.inter.GreetingService;
import org.apache.dubbo.common.extension.ExtensionLoader;

public class DubboSPIExample {
    public static void main(String[] args) {
        // 获取扩展加载器
        ExtensionLoader<GreetingService> loader = ExtensionLoader.getExtensionLoader(GreetingService.class);

        // 加载默认实现
        GreetingService defaultService = loader.getDefaultExtension();
        defaultService.sayHello("Java Developer");

        // 加载指定实现
        GreetingService chineseService = loader.getExtension("chinese");
        chineseService.sayHello("Java Developer");
    }
}
